package tn.redmine.data_models;

import core.Pilot;

public class User
{
	protected Pilot manager;
	private String firstName;
	private String lastName = "";
	private String email = "";
	private String position = "";
	private String category = "";
	private String level = "";
	private String salary = "";
	private String city = "";
	private String redmineID = "";
	private String redmineProject = "";
	private String company = "";

	/**
	 * Constructor
	 * @param p_manager
	 */
	public User(Pilot p_manager)
	{
		manager = p_manager;
	}

	public User print()
	{
		manager.log().info("First name" + getFirstName());
		manager.log().info("Last name: " + getLastName());
		manager.log().info("Email: " + getEmail());
		manager.log().info("Position: " + getPosition());
		manager.log().info("Category: " + getCategory());
		manager.log().info("Level: " + getLevel());
		manager.log().info("Salary: " + getSalary());
		manager.log().info("City: " + getCity());
		manager.log().info("Company: " + getCompany());
		manager.log().info("Redmine ID: " + getRedmineID());
		manager.log().info("Redmine project: " + getRedmineProject());

		return this;
	}

	public User setFirstName(String p_firstName)
	{
		this.firstName = p_firstName;

		return this;
	}

	public String getFirstName()
	{
		if (firstName == null)
		{
			manager.log().warn("'firstName' is not initialized");
		}

		return firstName;
	}

	public User setLastName(String p_lastName)
	{
		this.lastName = p_lastName;

		return this;
	}

	public String getLastName()
	{
		if (lastName == null)
		{
			manager.log().warn("'lastName' is not initialized");
		}

		return lastName;
	}

	public User setPosition(String p_position)
	{
		this.position = p_position;

		return this;
	}

	public String getPosition()
	{
		if (position == null)
		{
			manager.log().warn("'position' is not initialized");
		}

		return position;
	}

	public User setCategory(String p_category)
	{
		this.category = p_category;

		return this;
	}

	public String getCategory()
	{
		if (category == null)
		{
			manager.log().warn("'category' is not initialized");
		}

		return category;
	}

	public User setLevel(String p_level)
	{
		this.level = p_level;

		return this;
	}

	public String getLevel()
	{
		if (level == null)
		{
			manager.log().warn("'level' is not initialized");
		}

		return level;
	}

	public User setEmail(String p_email)
	{
		this.email = p_email;

		return this;
	}

	public String getEmail()
	{
		if (email == null)
		{
			manager.log().warn("'email' is not initialized");
		}

		return email;
	}

	public User setRedmineID(String p_redmineID)
	{
		this.redmineID = p_redmineID;

		return this;
	}

	public String getRedmineID()
	{
		if (redmineID == null)
		{
			manager.log().warn("'redmineID' is not initialized");
		}

		return redmineID;
	}

	public User setCity(String p_city)
	{
		this.city = p_city;

		return this;
	}

	public String getCity()
	{
		if (city == null)
		{
			manager.log().warn("'city' is not initialized");
		}

		return city;
	}

	public User setRedmineProject(String p_redmineProject)
	{
		this.redmineProject = p_redmineProject;

		return this;
	}

	public String getRedmineProject()
	{
		if (redmineProject == null)
		{
			manager.log().warn("'redmineProject' is not initialized");
		}

		return redmineProject;
	}

	public User setCompany(String p_company)
	{
		this.company = p_company;

		return this;
	}

	public String getCompany()
	{
		if (company == null)
		{
			manager.log().warn("'company' is not initialized");
		}

		return company;
	}

	public User setSalary(String p_salary)
	{
		this.salary = p_salary;

		return this;
	}

	public String getSalary()
	{
		if (getPosition().equals("QA Automation Engineer"))
		{
			if (getCity().equals("ZP"))
			{
				return getSalaryQaAutoZP();
			}
			else if (getCity().equals("DP"))
			{
				return getSalaryQaAutoDP();
			}
		}
		else if (getPosition().equals("QA Engineer"))
		{
			if (getCity().equals("ZP"))
			{
				return getSalaryQaManualZP();
			}
			else if (getCity().equals("DP"))
			{
				return getSalaryQaManualDP();
			}

			return "";
		}

		return "";
	}

	private String getSalaryQaManualDP()
	{
		switch (getLevel())
		{
			case "1":
			{
				return "490";
			}
			case "2":
			{
				return "610";
			}
			case "3":
			{
				return "670";
			}
			case "4":
			{
				return "730";
			}
			case "5":
			{
				return "935";
			}
			case "6":
			{
				return "1035";
			}
			case "7":
			{
				return "1170";
			}
			case "8":
			{
				return "1355";
			}
			case "9":
			{
				return "1535";
			}
			case "10":
			{
				return "1585";
			}
			case "11":
			{
				return "1830";
			}
			default:
			{
				return "";
			}
		}

	}

	private String getSalaryQaManualZP()
	{
		switch (getLevel())
		{
			case "1":
			{
				return "425";
			}
			case "2":
			{
				return "550";
			}
			case "3":
			{
				return "610";
			}
			case "4":
			{
				return "730";
			}
			case "5":
			{
				return "860";
			}
			case "6":
			{
				return "975";
			}
			case "7":
			{
				return "1035";
			}
			case "8":
			{
				return "1160";
			}
			case "9":
			{
				return "1340";
			}
			case "10":
			{
				return "1585";
			}
			case "11":
			{
				return "1830";
			}
			default:
			{
				return "";
			}
		}
	}

	private String getSalaryQaAutoDP()
	{
		switch (getLevel())
		{
			case "1":
			{
				return "610";
			}
			case "2":
			{
				return "730";
			}
			case "3":
			{
				return "855";
			}
			case "4":
			{
				return "935";
			}
			case "5":
			{
				return "1100";
			}
			case "6":
			{
				return "1280";
			}
			case "7":
			{
				return "1400";
			}
			case "8":
			{
				return "1645";
			}
			case "9":
			{
				return "1830";
			}
			case "10":
			{
				return "1950";
			}
			case "11":
			{
				return "2075";
			}
			default:
			{
				return "";
			}
		}
	}

	private String getSalaryQaAutoZP()
	{
		switch (getLevel())
		{
			case "1":
			{
				return "610";
			}
			case "2":
			{
				return "670";
			}
			case "3":
			{
				return "730";
			}
			case "4":
			{
				return "860";
			}
			case "5":
			{
				return "975";
			}
			case "6":
			{
				return "1100";
			}
			case "7":
			{
				return "1280";
			}
			case "8":
			{
				return "1400";
			}
			case "9":
			{
				return "1585";
			}
			case "10":
			{
				return "1830";
			}
			case "11":
			{
				return "1950";
			}
			default:
			{
				return "";
			}
		}
	}

}
